package org.acghub.mtdb.core;

import org.acghub.mtdb.core.engine.DocumentMongoDBStorageEngine;
import org.acghub.mtdb.core.engine.JsonMySQLStorageEngine;

/**
 * @author zhouhe
 */

public enum StorageEngineType {

    //document
    DOCUMENT_ROCKSDB {
        @Override
        public StorageEngine newInstance() {
            return null;
        }
    },
    DOCUMENT_MYSQL {
        @Override
        public StorageEngine newInstance() {
            return null;
        }
    },
    DOCUMENT_MONGODB {
        @Override
        public StorageEngine newInstance() {
            return new DocumentMongoDBStorageEngine();
        }
    },

    //json
    JSON_ROCKSDB {
        @Override
        public StorageEngine newInstance() {
            return null;
        }
    },
    JSON_MYSQL {
        @Override
        public StorageEngine newInstance() {
            return new JsonMySQLStorageEngine();
        }
    },
    JSON_MONGODB {
        @Override
        public StorageEngine newInstance() {
            return null;
        }
    };

    public abstract StorageEngine newInstance();

    public static StorageEngineType of(String value) {
        for (StorageEngineType engineType : StorageEngineType.values()) {
            if (engineType.name().equalsIgnoreCase(value)) {
                return engineType;
            }
        }
        return null;
    }
}